import request from '@/utils/request'

// 获取公钥
export function getPubKey(params) {
  return request({
    url: 'auth/staff/getRsaPublicKey', // 每个项目的接口url不一样 根据实际情况修改
    method: 'get', // 同理
    params
  })
}
/** 登录api */
export function strangeLoginApi(data) {
  return request({
    url: 'auth/staff/doLogin',
    method: 'post',
    data
  })
}

// /** 获取验证码 */
export function getCurd(data) {
  return request({
    url: 'auth/staff/sendLoginMobileCode',
    method: 'post',
    data
  })
}
// /** 手机号登陆 */
export function loginApi(data) {
  return request({
    url: 'auth/staff/doLoginByMobileToVerify',
    method: 'post',
    data
  })
}

// /** 账号密码登陆 */
export function getAllowPWLoginList(data) {
  return request({
    url: 'api/login/getAllowPWLoginList',
    method: 'post',
    data
  })
}

// 获取公钥
export function getRsaPublicKey() {
  return request({
    url: 'auth/staff/getRsaPublicKey',
    method: 'get'
  })
}

// 修改密码
export function changePassword(data) {
  return request({
    url: 'auth/staff/changePassword',
    method: 'post',
    data
  })
}

// 修改密码 获取验证码
export function sendChangePasswordValidateCode(data) {
  return request({
    url: 'auth/staff/sendChangePasswordValidateCode',
    method: 'post',
    data
  })
}
// 修改密码 获取验证码
export function changePasswordByValidateCode(data) {
  return request({
    url: 'auth/staff/changePasswordByValidateCode',
    method: 'post',
    data
  })
}

// 手动过期token
export function kickOutStaff(params) {
  return request({
    url: 'new/staff/kickOutStaff',
    method: 'post',
    params
  })
}


export function changeStaffLogin(data, headers) {
  return request({
    url: 'new/admin/changeStaffLogin',
    method: 'post',
    data,
    headers: headers
  })
}
export default {
  getPubKey,
  loginApi,
  getCurd,
  strangeLoginApi,
  getAllowPWLoginList,
  getRsaPublicKey,
  changePassword,
  sendChangePasswordValidateCode,
  changePasswordByValidateCode,
  kickOutStaff,
  changeStaffLogin
}
